package dryven.request.controller.result;

import dryven.request.controller.ControllerDescription;

/**
 * Listen for the ControllerDescription that led to the
 * execution of an action. This interface is used in 2 ways:
 * 
 * First as an interface that an ActionResult can implement.
 * After a ForwardAction got the result back from the controller
 * it will check whether it can cast the result to this interface.
 * If that is the case, passOriginatingController will be called
 * on the result.
 * 
 * Secondly, other classes than an ActionResult can implement this
 * interface. In that case, if they are contained an ActionResult that
 * also implements this interface, and that result is returned from
 * a controller, their passOriginatingController will also be called.
 * 
 * Here is an example to illustrate:
 * Your controller action returns a ViewResult with inside
 * the viewdata that contains a Form. ViewResult implements
 * this interface, and tries to cast all values in its viewdata
 * to this interface too. If it succeeds, it calls passOriginatingController
 * on them too (in this case, the Form object contained in the viewdata).
 * 
 * ForwardResult also implements this interface. It forwards the 
 * passOriginatingController call to all parameters in the new
 * ControllerDescription.
 * @author bwindels
 *
 */
public interface OriginatingControllerListener {
	public void passOriginatingController(ControllerDescription cd);
}
